﻿using System.Collections.Generic;

namespace Vk
{
    public struct ApiError
    {
        public ApiError(ApiNode rootNode)
        {
            Code = rootNode.Int("error_code");
            Description = rootNode.String("error_description");

            RequestParameters = new Dictionary<string, string>();
            foreach (var node in rootNode.SelectNodes("request_params/param"))
            {
                RequestParameters.Add(node.String("key"), node.String("value"));
            }
        }

        public int? Code { get; set; }
        public string Description { get; set; }
        public Dictionary<string, string> RequestParameters { get; set; }
    }

    public struct ApiCaptchaInfo
    {
        public string Id;
        public string ImagePath;

        public ApiCaptchaInfo(ApiNode rootNode)
        {
            Id = rootNode.String("captcha_sid");
            ImagePath = rootNode.String("captcha_img");
        }
    }
}